package com.javafactroy.kunlong.test.strtemplate;

import com.javafactroy.kunlong.DbAgent;
import com.javafactroy.kunlong.common.utils.CommonUtils;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.MethodOrderer;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInstance;
import org.junit.jupiter.api.TestMethodOrder;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit.jupiter.SpringExtension;

import java.util.HashMap;
import java.util.Map;

/**
 * 拿客
 * www.coderknock.com
 * QQ群：213732117
 * 建设时间：2016年07月14日
 * 描写：StringTemplateParser
 */
@SpringBootTest(classes = {DbAgent.class}, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@ExtendWith(SpringExtension.class)
@Slf4j
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
@TestMethodOrder(MethodOrderer.MethodName.class)
public class JoddStringTemplateParser {
    @Test
    public void test001_parseTemplate() {
        String template = "Hello ${foo}. ${foo} Today is ${dayName}.";

        // prepare data
        Map<String, String> map = new HashMap<String, String>();
        map.put("foo", "Jodd");
        map.put("dayName", "Sunday");
        String result = CommonUtils.parseTemplate(template, map);
        log.info("parse result =  {}", result);

    }

    public static class TestIoCls {

    }

    //desenseitize
}